#include <sound.h>
#include <input.h>
#include <stdio.h>

int quit = 0;

Bool func (unsigned char scan_code, void *data)
{
	if (scan_code == 1)
		quit = 1;
	return true;
}


int main (int argc, char **argv) 
{
	if (argc != 2) {
		printf ("Uso: %s <ficheiro de som>\n", argv[0]);
		return 1;
	}
	sound_init ();
	input_init ();
	input_keyboard_register (func, 0, 0);
	Sound s = sound_load (argv[1]);
	if (s == NULL) {
		sound_finish ();
		printf ("Uso: %s <ficheiro de som>\n", argv[0]);
		return 1;
	}
	sound_music_play (s);
	printf ("Pressione ESC para sair\n");

	while (!quit) { 
		input_keyboard_read ();
		sound_milisleep (10);
	}
	input_finish ();
	sound_finish ();
	return 0;
}


